package mavenstudy;

import mavenstudy.api.IFlight;
import mavenstudy.dto.Flight;

import java.util.ArrayList;
import java.util.List;



/**
 * ProjectName：mavenstudy
 * ClassName：FlightImpl
 *
 * @author：hldiao
 * @date：14:39 2018/7/2
 */
public class FlightImpl implements IFlight {
    /**
     *
     * @param orgin 出发地
     * @param dest 到达地
     * @return
     */
    public List<Flight> queryFlightByCabin(String orgin, String dest) {
        List<Flight> flights = Utils.queryFlights();
        List<Flight> results = new ArrayList<Flight>();
        for(Flight flight : flights){
            if(flight.getOrigin().equals(orgin) && flight.getDest().equals(dest)){
                results.add(flight);
            }
        }
        return results;
    }
}
